<template>
    <div class="newsinfo-container">
        <!-- 大标题 -->
        <h3 class="title">{{ newsinfo.title }}</h3>
        <!-- 小标题 -->
        <p class="subtitle">
            <span>发表时间：</span>
            <span>点击：次</span>
        </p>
        <hr>
        <!-- 内容 -->
        <div class="content" v-html="newsinfo.content">

        </div>
        <!-- 评论 -->
    </div>
</template>
<script>
import {Toast} from "mint-ui"
export default {
    data(){
        return{
            id : this.$route.params.id,
            newsinfo:{}
        }
    },
    created(){
        this.getNewsInfo()
    },
    methods: {
        getNewsInfo(){
            this.$http.get('http://127.0.0.1:3002/info').then(result => {
                if(result.status === 200){
                    this.newsinfo = result.body[0];
                }else{
                    Toast('获取失败')
                }
            })
        }
    },
}
</script>
<style lang="less" scoped>
    .newsinfo-container{
        padding: 0 4px;
        .title{
            font-size: 1.5em;
            text-align: center;
            margin: .5em 0px;
            padding: 0;
        }
        .subtitle{
            font-size: .7em;
            color: lightblue;
            display: flex;
            justify-content: space-between;
        }
    }
</style>